/*******************************************************
*  Team name: FTPMP
*  Class involve: SACardWindow SACardController
*  Version, Author, History of modification: 
*  
*  Version 1.0, Fred,
*  	- add SACardController, setLabel
*******************************************************/

package boundary;

import java.awt.CardLayout;
import java.awt.Font;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;

import control.SACardController;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;


public class SACardWindow extends CardWindow implements ActionListener
{
	SACardController SACardController;
	int pid;
	int said;
	JButton ok_btn;
	int ans=0;
	public SACardWindow(CardLayout cl, RoundWindow RW, SACardController SACardController )
	{

		super(cl,RW);
		JLabel title = new JLabel("SA Card");
		super.CardPanel.add(title);
		this.SACardController=SACardController;
		this.SACardController.initSACardWindow(this);
	}

	public void process() 
	{
		this.SACardController.answeredEvent(this.pid, this.said, this.ans);		
	}
	public void setDisplay()
	{
		
	}

	public void setLabel(String saName, String info, int said, int pid) 
	{
		roundWindow.printSAPanel();
		this.said = said;
		this.pid = pid;
		JLabel name = new JLabel(saName);
		JLabel sainfo = new JLabel(info);
		
		ok_btn = new JButton("OK");
		
		
		setLayout(null);
		
		name.setFont(new Font("Dialog", Font.PLAIN, 20));
		name.setBounds(379, 123, 40, 33);
		sainfo.setFont(new Font("Dialog", Font.PLAIN, 16));
		sainfo.setBounds(281, 256, 256, 42);
		ok_btn.setFont(new Font("Tahoma", Font.PLAIN, 18));
		ok_btn.setBounds(352, 339, 103, 33);
		ok_btn.addActionListener(this);
		
		add(name);
		add(sainfo);
		add(ok_btn);
		
	}
	
	public void actionPerformed(ActionEvent e)
	{
		if(e.getSource()==ok_btn)
		{
			process();
			roundWindow.printBoardPanel();
            roundWindow.printMTPanel();
		}	
	}
}
